package com.easysoft.framework.action;
import com.easysoft.framework.beans.Page;
import com.easysoft.framework.casereply.model.SysCaseReplyQuery;
import com.easysoft.framework.casereply.model.SysCaseReplyView;
import com.easysoft.framework.casereply.model.SysCasematerialQuery;
import com.easysoft.framework.casereply.model.SysCasematerialView;
import com.easysoft.framework.casereply.service.SysCasematerialService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;

/**
 * Created by try on 2017/9/12.
 *
 * 证据材料
 */
@RestController
@RequestMapping(value = SystemCasematerialAction.BASE_VIEW)
public class SystemCasematerialAction {

    public static final String BASE_VIEW = "/caseReply";
    private static final Logger logger = LoggerFactory.getLogger(SystemCasematerialAction.class);


    @Autowired
    @Qualifier("service.SysCasematerialService")
    private SysCasematerialService sysCasematerialService;
    /**
     * 分页查证据材料
     * @param page  分页信息
     * @param query 查询条件
     * @return 证据材料
     */
    @RequestMapping(value = "/listCasematerial", method = {RequestMethod.POST, RequestMethod.GET})
    public ModelAndView listCasematerial(Page page, SysCasematerialQuery query) {
        logger.info("Call SystemCasematerialAction.listCasematerial({},{})", page.toString(), query.toString());
        List<SysCasematerialView> list = sysCasematerialService.selectSysCasematerialListByPage(query,page);
        ModelAndView mv = new ModelAndView(BASE_VIEW + "/listCasematerial");
        mv.addObject("page", page);
        mv.addObject("query", query);
        mv.addObject("listCasematerial", list);
        return mv;
    }

}
